3 struct MapNotes: View {
13 ForEach(notes, id: \.id) { note in
14 Text(note.text.replacingOccurrences(of: "\\n", with: "\n")).font(.theme.axisLabel)
17 .foregroundColor(.map.labelColor)
18 .border(Color.map.vertexColor, width: lineWidth)
19 .frame(minWidth: 16.0, maxWidth: maxWidth, alignment: .topLeading)
22 width: w(note.position.x),
23 height: h(note.position.y)
29 func h(_ dimension: CGFloat) -> CGFloat {
30 max(0.0, min(mapSize.height, dimension * mapSize.height / 100.0))
33 func w(_ dimension: CGFloat) -> CGFloat {
34 max(0.0, min(mapSize.width, dimension * mapSize.width / 100.0))
38 struct MapNotes_Previews: PreviewProvider {
39 static var previews: some View {
41 mapSize: CGSize(width: 400.0, height: 400.0), lineWidth: 1.0,
43 Note(id: 0, position: CGPoint(x: 50.0, y: 50.0), text: "Notes can have a lot more text, so we need to make sure that they're resized correctly"),